package com.example.vpn_demo.packet

data class Packet(
    val protocol: Protocol,
    val sourceAddress: String,
    val sourcePort: Int,
    val destinationAddress: String,
    val destinationPort: Int,
    val data: ByteArray
) {
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false

        other as Packet

        if (protocol != other.protocol) return false
        if (sourceAddress != other.sourceAddress) return false
        if (sourcePort != other.sourcePort) return false
        if (destinationAddress != other.destinationAddress) return false
        if (destinationPort != other.destinationPort) return false
        if (!data.contentEquals(other.data)) return false

        return true
    }

    override fun hashCode(): Int {
        var result = protocol.hashCode()
        result = 31 * result + sourceAddress.hashCode()
        result = 31 * result + sourcePort
        result = 31 * result + destinationAddress.hashCode()
        result = 31 * result + destinationPort
        result = 31 * result + data.contentHashCode()
        return result
    }
} 